package com.example.thm.manager;

import android.content.Context;
import android.util.Log;

public class GlobalManager {
	
	private DatenbankManager dbmanager;
	private BuchManager bmanager;
	private TransaktionManager tmanager;
	private IntervallTransaktionManager itmanager;
	private WaehrungManager wmanager;
	private KategorieManager kmanager;
	private PasswortManager pmanager;
	
	public GlobalManager(){}
	
	public GlobalManager(Context context){
		dbmanager = new DatenbankManager(context);
		dbmanager.open();
		bmanager = new BuchManager(this);
		tmanager = new TransaktionManager(this);
		itmanager = new IntervallTransaktionManager(this);
		wmanager = new WaehrungManager(this);
		kmanager = new KategorieManager(this);
		pmanager = new PasswortManager(this);
	}
	
	public DatenbankManager getDatenbankManager(){
		return dbmanager;
	}
	
	public BuchManager getBuchManager(){
		return bmanager;
	}
	
	public TransaktionManager getTransaktionManager(){
		return tmanager;
	}
	
	public IntervallTransaktionManager getIntervallTransaktionManager(){
		return itmanager;
	}
	
	public WaehrungManager getWaehrungManager(){
		return wmanager;
	}
	
	public KategorieManager getKategorieManager(){
		return kmanager;
	}
	
	public void finalize() throws Throwable {
		Log.d("THM_Haushaltsbuch", "GlobalManager finalize()");
		dbmanager.close();
	}

	public PasswortManager getPasswortManager() {
		return pmanager;
	}

	public void setPasswortManager(PasswortManager pmanager) {
		this.pmanager = pmanager;
	}
}
